﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ZFSData;
using ZFSData.InterFace.User;
using ZFSData.Manager;

namespace ZFSBusiness
{

    /// <summary>
    /// 用户组管理 
    /// </summary>
    public class GroupManager : BaseManager<GroupManager>, IGroup
    {
        public tb_Group AddEntity(tb_Group entity)
        {
            throw new NotImplementedException();
        }

        public bool DeleteEntity(tb_Group entity)
        {
            throw new NotImplementedException();
        }

        public bool ExistEntity(Expression<Func<tb_Group, bool>> whereLambda)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 获取指定组权限
        /// </summary>
        /// <param name="groupCode"></param>
        /// <returns></returns>
        public List<tb_GroupFunc> GetGroupFuncs(string groupCode)
        {
            return factoryManager.GetGroupManager().GetGroupFuncs(groupCode);
        }

        /// <summary>
        /// 获取用户组
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public List<tb_Group> GetGroups(string search)
        {
            return factoryManager.GetGroupManager().GetGroups(search);
        }

        /// <summary>
        /// 获取组用户
        /// </summary>
        /// <param name="groupCode"></param>
        /// <returns></returns>
        public List<View_GroupUser> GetGroupUsers(string groupCode)
        {
            return factoryManager.GetGroupManager().GetGroupUsers(groupCode);
        }

        public List<tb_Group> GetModels(Expression<Func<tb_Group, bool>> whereLambda)
        {
            throw new NotImplementedException();
        }

        public List<tb_Group> GetPagingModels<S>(int pageIndex, int pageSize, out int totalCount, Expression<Func<tb_Group, bool>> whereLambda, Expression<Func<tb_Group, S>> orderbyLambda, bool Asc = false)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 移除组
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Remove(int id)
        {
            return factoryManager.GetGroupManager().Remove(id);
        }

        public bool UpdateEntity(tb_Group entity)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 更新用户组权限
        /// </summary>
        /// <param name="funcList"></param>
        /// <returns></returns>
        public bool UpdateGroupFunc(tb_Group group, List<View_GroupUser> userList, List<tb_GroupFunc> funcList)
        {
            return factoryManager.GetGroupManager().UpdateGroupFunc(group, userList, funcList);
        }
    }
}
